package com.entor.util;

import com.fasterxml.jackson.databind.ObjectMapper;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class PrintUtil{
    public static  void print(HttpServletResponse response, Object o) throws IOException {
        PrintWriter print = response.getWriter();
        response.setContentType("application/json; charset=utf-8");
        ObjectMapper mapper=new ObjectMapper();
        String s = mapper.writeValueAsString(o);
        print.write(s);
        print.close();
        print.flush();
    }
}
